<?php 
class District_model extends Model {
	
	var $tbl_name = 'district';
	
	function District_model() {
		parent::Model();
	}
	
	function addDistrict($ary_info=array()) {
		$this->db->insert($this->tbl_name, $ary_info);
		
		return $this->db->insert_id();
	} 
	
	function updateDistrict($id,$ary_info=array())
	{
		$this->db->where('id', $id);
		echo $this->db->last_query();
		exit;
		$this->db->update($this->tbl_name, $ary_info); 			
	}	
	
	function deleteDistrict($id)	
	{
		$this->db->delete($this->tbl_name, array('id' => $id)); 	
	}
	
	function getDistricts($ary_info=array()) {
		$this->db->where($ary_info);
		
		$query = $this->db->get($this->tbl_name);
		if ($query->num_rows()>0) {
			return $query->result_array(); 
		}
	}
	
	function getDistrict($ary_info=array()) {
		$this->db->where($ary_info);
		
		$query = $this->db->get($this->tbl_name);
		
		echo $this->db->last_query();
		exit;
		if ($query->num_rows()>0) {
			return $query->row_array(); 
		}
	}
}